require(['./config'],function(){
	require(['loadHF'],function(){
		class losub{
			constructor() {
			   this.addListeren()
			}
			addListeren(){
				$(".reg-submit").on("click",this.loginsub)
			}
			loginsub(e){
				e.preventDefault()
				const _form=$(e.target).parents("form")
				const _phonenumber=$(_form).find("input:nth-of-type(1)").val()
				const _password=$(_form).find("input:nth-of-type(2)").val()
				const _data=`phonenumber=${_phonenumber}&password=${_password}`
				// console.log(_data)
				$.post("/api/login.php",_data,function(aa){
					// console.log(aa.data)
					if(aa.data.status==1){
						// console.log("aa")
						location="/index.html"
					}else{
						$("form p").text(aa.data.message)
						$(_form).find("input:nth-of-type(1)").val("")
						$(_form).find("input:nth-of-type(2)").val("")
					}
				},"json")
			}
		}
		new losub()
	})
})